package object_string_0920;
public class Student {
    public String name;
    public int score;
    @Override
    //覆写toString方法
    public String toString() {
        return name+score;
    }

    @Override
    //覆写equals方法！！！重要
    public boolean equals(Object obj) {
        if(this==obj) {
            return true;
        }
        if(!(obj instanceof Student)){
            return false;
        }
        //向下转型
        Student student=(Student) obj;
        return this.name.equals(student.name);
    }
}


